

<template>
  <div class="page">
    <van-tabs :active="activeIndex" swipeable>
      <van-tab :title="gudongTitle">
        <gudong @countChange="countChange"></gudong>
      </van-tab>
      <van-tab :title="gaoguanTitle">
        <gaoguan @countChange="countChange"></gaoguan>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import Gudong from './gudong';
import Gaoguan from './gaoguan';

export default {
  components: {
    Gudong,
    Gaoguan
  },
  data() {
    return {
      gudong: 0,
      gaoguan: 0
    };
  },
  computed: {
    gudongTitle() {
      return `股东(${this.gudong})`;
    },
    gaoguanTitle() {
      return `高管(${this.gaoguan})`;
    }
  },
  onUnload() {
    this.activeIndex = 0;
    this.gudong = 0;
    this.gaoguan = 0;
  },
  methods: {
    countChange(item) {
      this[item.type] = item.count;
    }
  }
};
</script>
